import { createStore } from 'vuex'

// 创建一个新的 store 实例
const store = createStore({
  state: {
    get UserToken() {
      return localStorage.getItem('token')
    },
    set UserToken(value) {
      localStorage.setItem('token', value)
    }
  },
  mutations: {
    LOGIN_IN(state, token) {
      state.UserToken = token
    },
    // 登出
    LOGIN_OUT(state) {
      state.UserToken = ""
    }
  }
})


export default store
